import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
      // 底部导航栏激活状态
      bottomNavActive: 0,
      //传需要评论的订单的ID
      commentOrderID: 0
  },
  mutations: {
    //设置首页底部导航栏激活状态
    setBottomNavActive(state,active) {
      state.bottomNavActive = active
    },
    setCommentOrderID(state,id) {
      state.commentOrderID = id
    }
  },
  getters: {
      //截取电话号码
      showTel: state => {
        return state.userInfo.userPhone.substring(0,3)+ '****'+ state.userInfo.userPhone.substring(state.userInfo.userPhone.length-4)
      }
  }
})